package com.topscore.utillibrary.util;

import android.graphics.Bitmap;
import android.support.annotation.DrawableRes;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;

/**
 * Created by 71468 on 2017/9/13.
 */

public class ImageDisplayOptionManager {
    private static ImageDisplayOptionManager instance;

    public static ImageDisplayOptionManager getInstance() {
        instance = new ImageDisplayOptionManager();
        return instance;
    }

    public DisplayImageOptions defaultOption(@DrawableRes int imageRes){
        return new DisplayImageOptions.Builder()
                .showImageOnLoading(imageRes)
                .showImageOnFail(imageRes)
                .showImageForEmptyUri(imageRes)
                .bitmapConfig(Bitmap.Config.ARGB_8888)
                .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .bitmapConfig(Bitmap.Config.RGB_565)
                .build();
    }
}
